<?php  
  
class productsModel extends Model{  
  
    function productsModel(){  
  
        parent::Model();  
  
    }  
  
    function getProduct($id){  
  
        $data = array();  
  
        $where = array('prod_id' => $id);  
  
        $query = $this->db->getwhere('products',$where,1);  
  
            if ($query-> num_rows() > 0){  
                $data = $query-> row_array();  
            }  
  
        $query->free_result();  
  
        return $data;  
  
    }  
  
    function getAllProducts(){  
  
        $data = array();  
  
        $query = $this-> db-> get('products');  
  
        if ($query-> num_rows() > 0){  
            foreach ($query-> result_array() as $row){  
            $data[] = $row;  
            }  
        }  
  
        $query-> free_result();  
  
        return $data;  
    }  
}
?>